import {BrowserModule} from '@angular/platform-browser';
import {LOCALE_ID, NgModule} from '@angular/core';

import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {SharedModule} from './shared/shared.module';
import {HomeModule} from './home/home.module';
import {registerLocaleData} from '@angular/common';

import localZh from '@angular/common/locales/zh-Hans';
import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';
import {ParamInterceptor} from './home/interceptors/param.interceptor';
import {NotificationInterceptor} from './home/interceptors/notification.interceptor';
import {RecommendModule} from './recommend/recommend.module';
import {MyModule} from './my/my.module';
import {CategoryModule} from './category/category.module';
import {ChatModule} from './chat/chat.module';
import {ProductModule} from './product/product.module';

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    SharedModule,
    HttpClientModule,
    HomeModule,
    CategoryModule,
    ChatModule,
    RecommendModule,
    MyModule,
    ProductModule,
  ],
  providers: [
    {
      provide: LOCALE_ID,
      useValue: 'zh-Hans'
    },
    {
      provide: HTTP_INTERCEPTORS,
      useClass: ParamInterceptor,
      multi: true
    },
    {
      provide: HTTP_INTERCEPTORS,
      useClass: NotificationInterceptor,
      multi: true
    }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
  constructor() {
    registerLocaleData(localZh, 'zh');
  }
}
